<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
                 com.scalar.chiptrack.operations.material.MaterialRequest,
                 com.scalar.chiptrack.users.User,
                 com.scalar.chiptrack.commons.SessionKeys"%>


<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/materialRequest.do"/>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>
<% User user1 = (User)session.getAttribute (SessionKeys.USER_KEY); %>
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>

<html:html locale="true">
<HEAD>
<TITLE>Scalar Soft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>

<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<!-- Top Header Start-->

<%@include file="/jsp/includes/header.jsp" %>

<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->
<%@ include file="/jsp/operations/operations_menu.jsp" %></TD>
<!-- end of the side navigations -->
<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD valign="top" width="100%"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<br><br>

<!-- from here your body starts -->
<center><span class="NArialW">Materials Request</span></center>

<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=30>


<!-- DISPLAY MATERIAL'S STARTS HERE -->
<table border="0" width="85%" bordercolor="#FFFFFF" align=center>
        <tr><td class="NArialL" colspan=6>
        <chiptrack:errors styleClass='NArialL' />
        <chiptrack:info styleClass='NArialL' />
        <!--Bhaskar modified this link from MODIFY to VIEW on 16 july to facilitate information message display.-->
        </td></tr>
         <% if ( !user1.isActionAllowed ( Functionality.MATERIAL_REQUEST, 
         User.USER_ACTION_DELETE ) ) { %>
            <tr><td colspan='5'><font class='NArialS'><font color='blue'><b>You don't have permission to delete this record(s)</font></b></td></tr>
        <% } %>    

        <tr><td class="NArialL" colspan=6>To add a new Materials Request, please
        <chiptrack:restrictedLink functionality="<%=Functionality.MATERIAL_REQUEST%>" action="<%=User.USER_ACTION_VIEW%>" href="/chiptrack/materialRequest.do?action=create" onmouseover="window.status='Create New Materials Request and Authorization';return true"  onmouseout="window.status=' ';return true">[Click Here]</chiptrack:restrictedLink>
        </td></tr>
	<tr><td class="NArialL" colspan=6><IMG src="images/spacer.gif" height=10></td></tr>
        <tr>
        <td width="10%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Materials Request Number</font></td>
        <td width="15%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Internal Issue Department</font></td>
        <td width="15%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Internal Received Department</font></td>
        <td width="15%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">External Issue Department</font></td>
        <td width="15%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">External Received Department</font></td>
        <td width="30%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Actions</font></td>
       </tr>
       <%

            java.util.LinkedList materialRequestList = (java.util.LinkedList)request.getAttribute("materialRequestList");
            if (materialRequestList == null) materialRequestList = new java.util.LinkedList();
            MaterialRequest materialRequest = null;
            int materialRequestListSize = materialRequestList.size();
            if(materialRequestListSize <= 0){
                %><tr><td colspan =6 align="center" bgcolor='#DEE1E2'><font class="NArialL">No Materails Request</font>
                  </td></tr>
                <%
            }else{
                java.util.ListIterator materialRequestListIterator = (java.util.ListIterator)materialRequestList.listIterator(0);
                int i = 0;
                while( materialRequestListIterator.hasNext()) {
                   materialRequest = (MaterialRequest)materialRequestListIterator.next();
                    
               %> 

                <tr>
                <td width="10%" align="left" <%if (i%2 == 0) out.print ("bgcolor='#DEE1E2'");%>><font class="NArialL"><font color="#000000">&nbsp;<%=(materialRequest.getMaterialRequestNumber()==null) ? "&nbsp;" : materialRequest.getMaterialRequestNumber()%></font></td>
                <td width="15%" align="left" <%if (i%2 == 0) out.print ("bgcolor='#DEE1E2'");%>><font class="NArialL"><font color="#000000">&nbsp;<%=(materialRequest.getInternalIssueDepartment()==null)?"&nbsp;":materialRequest.getInternalIssueDepartment()%></font></td>
                <td width="15%" align="left" <%if (i%2 == 0) out.print ("bgcolor='#DEE1E2'");%>><font class="NArialL"><font color="#000000">&nbsp;<%=(materialRequest.getInternalReceivedDepartment()==null)?"&nbsp;":materialRequest.getInternalReceivedDepartment()%></font></td>
                <td width="15%" align="left" <%if (i%2 == 0) out.print ("bgcolor='#DEE1E2'");%>><font class="NArialL"><font color="#000000">&nbsp;<%=(materialRequest.getExternalIssueDepartment()==null)?"&nbsp;":materialRequest.getExternalIssueDepartment()%></font></td>
                <td width="15%" align="left" <%if (i%2 == 0) out.print ("bgcolor='#DEE1E2'");%>><font class="NArialL"><font color="#000000">&nbsp;<%=(materialRequest.getExternalReceivedDepartment()==null)?"&nbsp;":materialRequest.getExternalReceivedDepartment()%></font></td>
                <td width="30%" align="center" <%if (i%2 == 0) out.print ("bgcolor='#DEE1E2'");%>><font class="NArialL"><font color="#000000">
                <!--Bhaskar modified these three links on 16 july 2003 to display 
                all links despite privileges all options set to VIEW privileges-->
                <chiptrack:restrictedLink functionality='<%=Functionality.MATERIAL_REQUEST%>' action='<%=User.USER_ACTION_VIEW%>' href='<%="/chiptrack/materialRequest.do?action=view&materialrequestId=" + materialRequest.getMaterialRequestId()%>' onmouseover="window.status='Click for Materials Request View ';return true" onmouseout="window.status='';return true">View </chiptrack:restrictedLink>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <chiptrack:restrictedLink functionality='<%=Functionality.MATERIAL_REQUEST%>' action='<%=User.USER_ACTION_VIEW%>' href='<%="/chiptrack/materialRequest.do?action=modify&materialrequestId=" + materialRequest.getMaterialRequestId()%>' onmouseover="window.status='Click for Materials Request Modify ';return true" onmouseout="window.status='';return true">Modify </chiptrack:restrictedLink>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <chiptrack:restrictedLink functionality='<%=Functionality.MATERIAL_REQUEST%>' action='<%=User.USER_ACTION_DELETE%>' href='<%="/chiptrack/materialRequest.do?action=confirmdelete&materialrequestId=" + materialRequest.getMaterialRequestId() %>' onmouseover="window.status='Click for Materials Request Delete ';return true" onmouseout="window.status='';return true">Delete</chiptrack:restrictedLink></font>

               </td>
                </tr>
            <%
                i++;
                }
            }
            %>
</table>
</br>
<!-- DISPLAY MATERIAL'S ENDS HERE -->
</TD></TR>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>
<!-- Footer starts here -->
<%@include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</html:html>